<%@ page language="java" contentType="text/html" pageEncoding="utf-8"%>
<%@ include file="header.jsp" %>
<title>欢迎登录 - 红高粱</title>
<style type="text/css">
.clear_both{clear:both;margin-bottom:50px;}
body{ background-image:url("../m/images/c_shop_bg2.png"); max-width:640px;background-color:#000;}
*{margin:0; padding:0;}
ul li{ list-style:none;}
.login{width:80.4444%; margin:0 auto; padding:10.29% 0 0 0; line-height:0;margin-top: 20px;}
.head{width:100%;}
.logo {width:80%;margin:0 auto; margin-bottom:20px;overflow:hidden;}
.logo img{ width:100%;text-align:center;}
.middle{background-repeat:repeat-y;width:100%; background-size:contain;}
.center{ width:85.4838%;margin:0 auto;}
.middle .center{border-radius:0.2em;width:98%;text-align:center;margin:0 auto;overflow:hidden;color:#6c5c6ca;
background-size:cover;width:100%; }
.usename { padding:10px 0px; }
.usename img{ height:30px;vertical-align:bottom;}
.usename input{width:80%;background-color:transparent; border:none;line-height:1.6em; font-family:"黑体";color:#fff; font-size:1em; padding:0 0 0 5px;}
.usephone { padding:10px 0px;margin-top:10px}
.usephone img{ height:30px;vertical-align:bottom;}
.border{background:url("../m/images/u_i_b.png") repeat-x; background-position:bottom;}
.usephone input{width:80%; margin:0 0 0 1px; background-color:transparent; border:none; border-radius:0.4em; line-height:1.6em;font-family:"黑体";color:#fff; font-size:1em; padding:0 0 0 5px;}
.attention{margin:0 10px 0 0px;width:100%; overflow:hidden; text-align:right;}
.attention p{ font-size:0.9em;color:#939393;font-family:"黑体"; line-height:32px; text-align:left;}
.attention .check{ width:32.5%; float:left; font-size:0.84em; color:#939393;font-family:"黑体"; line-height:32px; margin:0 2px 0 0;}
.attention .check input{ margin:0 0px 0 0; width:15px; height:15px; padding:0 ; border:1px solid #c6c2c2; background-color:#fff;}
.submit{ overflow:hidden;width:98%;margin:0 auto;margin-top:20px; height:auto;margin-bottom:40px; }
.txt{text-align: center;color:#c5c6ca;font-size:16px; font-weight: bold;}
.txt a{color:#fff; text-decoration: none;margin-bottom:20px;}
</style> 
<script type="text/javascript">
$(document).ready(function(){
	 $("input").focus(function(){
		 $("html,body").animate({scrollTop:$(".center").offset().top-15}, 1000);		 
	});
	
});

</script>
</head>
<!-- 
.usename input{width:80%;background-color:#2b2e31; border:1px solid #2b2e31; border-radius:0.4em; line-height:1.6em; font-family:"é»ä½";color:#fff; font-size:1em; padding:0 0 0 5px;}
.middle .center{border-radius:0.2em;width:98%;text-align:center;margin:0 auto;overflow:hidden;color:#6c5c6ca;
background:url("../m/images/shop_info.png") no-repeat;background-size:cover;width:100%; }
input{box-shadow:none!important;-webkit-box-shadow:none!important;border: 1px solid #2b2e31!important;-webkit-appearance: none;}

 -->
<body>
	<div class="login">
        <div class="middle">
       		<div class="logo"><img src="../m/images/logo.png"></div>
        	<div class="center">
        		<div class="usename border" style="background:url('../m/images/user_textfield_bg.png') no-repeat;opacity:2;">
        			<img src="../m/images/login_p.png" ><input id="phone" type="text" placeholder="手机号码">
       			</div>
                <div class="usephone" style="background:url('../m/images/user_textfield_bg.png') no-repeat;opacity:2;">
               		<img src="../m/images/login_mm.png" ><input id="password" placeholder="密码"  type="password"/>
               	</div>
        	</div>
        	<div class="submit">
                	<a href="javascript:login();"><img src="../m/images/login.png" width="100%"></a>
            </div>
            <div class="clean"></div>
            <div class="txt">
            	还没有账号？<a href="<%=request.getContextPath()%>/user/register">赶紧注册</a>
            </div>
        </div>      
        <script type="text/javascript">
        	function login(){
        		var phone = $("#phone").val();
        		var password = $("#password").val();
        		var src = location.search;
        		var openId = src.substring(1, src.length)+"";
        		if(phone.length <=0 )
        		{
        			alert("手机号码不能为空");
        			return;
        		}
        		else if(password.length <=0){
        			alert("密码不能为空");
        			return;
        		}
        		
        		$.ajax({
        			url:"loginValid",
        			type:"POST",
        			data:{phone:phone,password:password,openId:openId},
        			dataType:"json",
        			success:function(data){
        				if(data.ok == 'ok'){
        					if(!!document.referrer && document.referrer.indexOf("register")<0
        							&& document.referrer.indexOf("updatePass")<0
        							&& document.referrer.indexOf("userUpdatePass")<0
        							&& document.referrer.indexOf("login")<0){
        						location.href = document.referrer;
        					}else{
        						location.href = "../category?cid=${loginId}#mp.weixin.qq.com";	
        					}
        				}else{
        					alert(data.msg);
        				}
        			}
        		});
        	}
        </script>
    </div>
</body>
<div class="clear_both"></div>
<%@ include file="footer.jsp" %>
</html>